<pre style="line-height: 100%;font-family:monospace;background-color:#ffffff; border-width:0.01mm; border-color:#000000; border-style:solid;padding:4px;font-size:10pt;"><span style="color:#808080;background-color:#ffffff;">/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
</span><span style="color:#000080;background-color:#ffffff;">package</span><span style="background-color:#ffffff;"> cal;

</span><span style="color:#000080;background-color:#ffffff;">import</span><span style="background-color:#ffffff;"> java.util.Hashtable;
</span><span style="color:#000080;background-color:#ffffff;">import</span><span style="background-color:#ffffff;"> javax.servlet.http.*;

</span><span style="color:#000080;background-color:#ffffff;">public</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">class</span><span style="background-color:#ffffff;"> Entries {

  </span><span style="color:#000080;background-color:#ffffff;">private</span><span style="background-color:#ffffff;"> Hashtable entries;
  </span><span style="color:#000080;background-color:#ffffff;">private</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">static</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">final</span><span style="background-color:#ffffff;"> String</span><span style="background-color:#ffffff;font-weight:bold;">[]</span><span style="background-color:#ffffff;"> time = {</span><span style="color:#008000;background-color:#ffffff;">"8am"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"9am"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"10am"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"11am"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"12pm"</span><span style="background-color:#ffffff;">,
                    </span><span style="color:#008000;background-color:#ffffff;">"1pm"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"2pm"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"3pm"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"4pm"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"5pm"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"6pm"</span><span style="background-color:#ffffff;">,
                    </span><span style="color:#008000;background-color:#ffffff;">"7pm"</span><span style="background-color:#ffffff;">, </span><span style="color:#008000;background-color:#ffffff;">"8pm"</span><span style="background-color:#ffffff;"> };
  </span><span style="color:#000080;background-color:#ffffff;">public</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">static</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">final</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">int</span><span style="background-color:#ffffff;"> rows = </span><span style="color:#0000ff;background-color:#ffffff;">12</span><span style="background-color:#ffffff;">;

  </span><span style="color:#000080;background-color:#ffffff;">public</span><span style="background-color:#ffffff;"> Entries () {
   entries = </span><span style="color:#000080;background-color:#ffffff;">new</span><span style="background-color:#ffffff;"> Hashtable (rows);
   </span><span style="color:#000080;background-color:#ffffff;">for</span><span style="background-color:#ffffff;"> (</span><span style="color:#000080;background-color:#ffffff;">int</span><span style="background-color:#ffffff;"> i=</span><span style="color:#0000ff;background-color:#ffffff;">0</span><span style="background-color:#ffffff;">; i &lt; rows; i++) {
     entries.put (time</span><span style="background-color:#ffffff;font-weight:bold;">[</span><span style="background-color:#ffffff;">i</span><span style="background-color:#ffffff;font-weight:bold;">]</span><span style="background-color:#ffffff;">, </span><span style="color:#000080;background-color:#ffffff;">new</span><span style="background-color:#ffffff;"> Entry(time</span><span style="background-color:#ffffff;font-weight:bold;">[</span><span style="background-color:#ffffff;">i</span><span style="background-color:#ffffff;font-weight:bold;">]</span><span style="background-color:#ffffff;">));
   }
  }

  </span><span style="color:#000080;background-color:#ffffff;">public</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">int</span><span style="background-color:#ffffff;"> getRows () {
    </span><span style="color:#000080;background-color:#ffffff;">return</span><span style="background-color:#ffffff;"> rows;
  }

  </span><span style="color:#000080;background-color:#ffffff;">public</span><span style="background-color:#ffffff;"> Entry getEntry (</span><span style="color:#000080;background-color:#ffffff;">int</span><span style="background-color:#ffffff;"> index) {
    </span><span style="color:#000080;background-color:#ffffff;">return</span><span style="background-color:#ffffff;"> (Entry)</span><span style="color:#000080;background-color:#ffffff;">this</span><span style="background-color:#ffffff;">.entries.get(time</span><span style="background-color:#ffffff;font-weight:bold;">[</span><span style="background-color:#ffffff;">index</span><span style="background-color:#ffffff;font-weight:bold;">]</span><span style="background-color:#ffffff;">);
  }

  </span><span style="color:#000080;background-color:#ffffff;">public</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">int</span><span style="background-color:#ffffff;"> getIndex (String tm) {
    </span><span style="color:#000080;background-color:#ffffff;">for</span><span style="background-color:#ffffff;"> (</span><span style="color:#000080;background-color:#ffffff;">int</span><span style="background-color:#ffffff;"> i=</span><span style="color:#0000ff;background-color:#ffffff;">0</span><span style="background-color:#ffffff;">; i&lt;rows; i++)
      </span><span style="color:#000080;background-color:#ffffff;">if</span><span style="background-color:#ffffff;">(tm.equals(time</span><span style="background-color:#ffffff;font-weight:bold;">[</span><span style="background-color:#ffffff;">i</span><span style="background-color:#ffffff;font-weight:bold;">]</span><span style="background-color:#ffffff;">)) </span><span style="color:#000080;background-color:#ffffff;">return</span><span style="background-color:#ffffff;"> i;
    </span><span style="color:#000080;background-color:#ffffff;">return</span><span style="background-color:#ffffff;"> -</span><span style="color:#0000ff;background-color:#ffffff;">1</span><span style="background-color:#ffffff;">;
  }

  </span><span style="color:#000080;background-color:#ffffff;">public</span><span style="background-color:#ffffff;"> </span><span style="color:#000080;background-color:#ffffff;">void</span><span style="background-color:#ffffff;"> processRequest (HttpServletRequest request, String tm) {
    </span><span style="color:#000080;background-color:#ffffff;">int</span><span style="background-color:#ffffff;"> index = getIndex (tm);
    </span><span style="color:#000080;background-color:#ffffff;">if</span><span style="background-color:#ffffff;"> (index &gt;= </span><span style="color:#0000ff;background-color:#ffffff;">0</span><span style="background-color:#ffffff;">) {
      String descr = request.getParameter (</span><span style="color:#008000;background-color:#ffffff;">"description"</span><span style="background-color:#ffffff;">);
      ((Entry)entries.get(time</span><span style="background-color:#ffffff;font-weight:bold;">[</span><span style="background-color:#ffffff;">index</span><span style="background-color:#ffffff;font-weight:bold;">]</span><span style="background-color:#ffffff;">)).setDescription (descr);
    }
  }

}












</span></pre>